<template>
  <svg class="svg-icon" aria-hidden="true" :width="width" :height="height">
    <use :xlink:href="symbolId" :fill="fill" />
  </svg>
</template>

<script setup>
import { computed } from 'vue';
const props = defineProps({
  icon: {
    type: String,
    required: true
  },
  width: {
    type: Number,
    default: 19
  },
  height: {
    type: Number,
    default: 19
  },
  fill: {
    type: String,
    default: '#ffffff'
  }
});
// 获取svg图标名称，需要和vite.config.js中的配置保持一致
const symbolId = computed(() => `#${props.icon}`);
</script>

<style lang="scss" scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
